home *** CD-ROM | disk | FTP | other *** search
/ Openstep 4.2 (Developer) / Openstep Developer 4.2.iso / NextDeveloper / Source / GNU / uucp / Uucp.framework / unix.subproj / link.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-09  |  654 b   |  39 lines

  1. /* link.c
  2.    Link two files.  */
  3.  
  4. #include "uucp.h"
  5.  
  6. #include "uudefs.h"
  7. #include "sysdep.h"
  8. #include "system.h"
  9.  
  10. #include <errno.h>
  11.  
  12. boolean
  13. fsysdep_link (zfrom, zto, pfworked)
  14.      const char *zfrom;
  15.      const char *zto;
  16.      boolean *pfworked;
  17. {
  18.   *pfworked = FALSE;
  19.   if (link (zfrom, zto) == 0)
  20.     {
  21.       *pfworked = TRUE;
  22.       return TRUE;
  23.     }
  24.   if (errno == ENOENT)
  25.     {
  26.       if (! fsysdep_make_dirs (zto, TRUE))
  27.     return FALSE;
  28.       if (link (zfrom, zto) == 0)
  29.     {
  30.       *pfworked = TRUE;
  31.       return TRUE;
  32.     }
  33.     }
  34.   if (errno == EXDEV)
  35.     return TRUE;
  36.   ulog (LOG_ERROR, "link (%s, %s): %s", zfrom, zto, strerror (errno));
  37.   return FALSE;
  38. }
  39.